package org.op.editor.doc;

import java.util.List;

import javax.swing.text.Document;

import org.op.FrameView;
import org.op.editor.EditorComponentView;
import org.op.service.WwDocumentInfo;
import org.op.service.config.ConfigurationService;
import org.op.service.doc.DocumentConversionService;
import org.op.service.fileio.FileRWService;
import org.op.service.log.LoggerService;
import org.op.util.MessageController;


public class EditorLoadControllerImpl implements EditorLoadController {
	
	private EditorComponentView editorView;
	private DocumentConversionService docConvertor;
	private FrameView frameView;
	private FileRWService fileRWService;
	private ConfigurationService configService;
	private MessageController messageController;
	private LoggerService logger;
	
	/**
	 *  Callback method to add the given document to the editor panel
	 * 
	 */
	public void loadFileIntoEditor(List<String> file, WwDocumentInfo docInfo) {
		try {
			Document doc = docConvertor.textToDocument(file);
			editorView.addEditor(doc, docInfo);
		} catch (Exception e) {
			e.printStackTrace();
			// TODO - Send out an error dialog to the user
		}
	}
	
	
	// Getters and setters
	public EditorComponentView getEditorView() {
		return editorView;
	}

	public void setEditorView(EditorComponentView editorView) {
		this.editorView = editorView;
	}

	public DocumentConversionService getDocConvertor() {
		return docConvertor;
	}

	public void setDocConvertor(DocumentConversionService docConvertor) {
		this.docConvertor = docConvertor;
	}
	
	public FrameView getFrameView() {
		return frameView;
	}
	
	public void setFrameView(FrameView frameView) {
		this.frameView = frameView;
	}

	public FileRWService getFileRWService() {
		return fileRWService;
	}

	public void setFileRWService(FileRWService fileRWService) {
		this.fileRWService = fileRWService;
	}


	public ConfigurationService getConfigService() {
		return configService;
	}


	public void setConfigService(ConfigurationService configService) {
		this.configService = configService;
	}


	public MessageController getMessageController() {
		return messageController;
	}


	public void setMessageController(MessageController messageController) {
		this.messageController = messageController;
	}


	public LoggerService getLogger() {
		return logger;
	}


	public void setLogger(LoggerService logger) {
		this.logger = logger;
	}

}
